﻿using Newtonsoft.Json;

namespace CuteRibs.WowArmory.Models
{
	#region Item
	/// <summary>
	/// {
	///		"id": 78798,
	///		"charName": "湮灭之光兜帽",
	///		"icon": "inv_helm_robe_raidpriest_k_01",
	///		"quality": 4,
	///		"tooltipParams": {}
	///	}
	/// </summary>
	[JsonObject]
	public class Item : BNObjectBase
	{
		public ItemSlot ItemSlot { get; set; }

		[JsonProperty("id")]
		public int Id { get; set; }

		[JsonProperty("name")]
		public string Name { get; set; }

		[JsonProperty("icon")]
		public string Icon { get; set; }

		/// <summary>
		/// 0 - #9D9D9D - Poor
		/// 1 - #FFFFFF - Common
		/// 2 - #1EFF00 - Uncommon
		/// 3 - #0070FF - Rare
		/// 4 - #A335EE - Epic
		/// 5 - #FF8000 - Legendary
		/// 6 - #E6CC80 - Artifact
		/// </summary>
		[JsonProperty("quality")]
		public int Quality { get; set; }

		[JsonProperty("tooltipParams")]
		public TooltipParams TooltipParams { get; set; }
	}
	#endregion

	#region ItemDetails
	/// <summary>
	///	{
	///		"id": 72828,
	///		"disenchantingSkillRank": 475,
	///		"description": "",
	///		"charName": "狡诈者之锋",
	///		"icon": "inv_axe_1h_430nightelf_c_01",
	///		"stackable": 1,
	///		"allowableClasses": [],
	///		"itemBind": 1,
	///		"bonusStats": [],
	///		"itemSpells": [],
	///		"buyPrice": 1746872,
	///		"itemClass": 2,
	///		"itemSubClass": 0,
	///		"containerSlots": 0,
	///		"weaponInfo": {},
	///		"inventoryType": 13,
	///		"equippable": true,
	///		"itemLevel": 378,
	///		"maxCount": 0,
	///		"maxDurability": 110,
	///		"minFactionId": 0,
	///		"minReputation": 0,
	///		"quality": 4,
	///		"sellPrice": 349374,
	///		"requiredSkill": 0,
	///		"requiredLevel": 85,
	///		"requiredSkillRank": 0,
	///		"itemSource": {},
	///		"baseArmor": 0,
	///		"hasSockets": false,
	///		"isAuctionable": false,
	///		"armor": 0,
	///		"displayInfoId": 101424
	///	}
	/// </summary>
	[JsonObject]
	public class ItemDetails : Item
	{
		[JsonProperty("disenchantingSkillRank")]
		public int DisenchantingSkillRank { get; set; }

		[JsonProperty("description")]
		public string Description { get; set; }

		[JsonProperty("stackable")]
		public int Stackable { get; set; }

		[JsonProperty("allowableClasses")]
		public int[] AllowableClasses { get; set; }

		[JsonProperty("itemBind")]
		public int ItemBind { get; set; }

		[JsonProperty("bonusStats")]
		public BonusStat[] BonusStats { get; set; }

		[JsonProperty("itemSpells")]
		public ItemSpell[] ItemSpells { get; set; }

		[JsonProperty("buyPrice")]
		public int BuyPrice { get; set; }

		[JsonProperty("itemClass")]
		public int ItemClass { get; set; }

		[JsonProperty("itemSubClass")]
		public int ItemSubClass { get; set; }

		[JsonProperty("containerSlots")]
		public int ContainerSlots { get; set; }

		[JsonProperty("weaponInfo")]
		public WeaponInfo WeaponInfo { get; set; }

		[JsonProperty("inventoryType")]
		public int InventoryType { get; set; }

		[JsonProperty("equippable")]
		public bool Equippable { get; set; }

		[JsonProperty("itemLevel")]
		public int ItemLevel { get; set; }

		[JsonProperty("itemSet")]
		public ItemSet ItemSet { get; set; }

		[JsonProperty("maxCount")]
		public int MaxCount { get; set; }

		[JsonProperty("maxDurability")]
		public int MaxDurability { get; set; }

		[JsonProperty("minFactionId")]
		public int MinFactionId { get; set; }

		[JsonProperty("minReputation")]
		public int MinReputation { get; set; }

		[JsonProperty("sellPrice")]
		public int SellPrice { get; set; }

		[JsonProperty("requiredSkill")]
		public int RequiredSkill { get; set; }

		[JsonProperty("requiredLevel")]
		public int RequiredLevel { get; set; }

		[JsonProperty("requiredSkillRank")]
		public int RequiredSkillRank { get; set; }

		[JsonProperty("socketInfo")]
		public SocketInfo SocketInfo { get; set; }

		[JsonProperty("itemSource")]
		public ItemSource ItemSource { get; set; }

		[JsonProperty("baseArmor")]
		public int BaseArmor { get; set; }

		[JsonProperty("hasSockets")]
		public bool HasSockets { get; set; }

		[JsonProperty("isAuctionable")]
		public bool IsAuctionable { get; set; }

		[JsonProperty("armor")]
		public int Armor { get; set; }

		[JsonProperty("displayInfoId")]
		public int DisplayInfoId { get; set; }
	}
	#endregion

	#region BonusStat
	/// <summary>
	///{
	///		"stat": 5,
	///		"amount": 371,
	///		"reforged": false
	///	}
	/// </summary>
	[JsonObject]
	public class BonusStat
	{
		[JsonProperty("stat")]
		public int Stat { get; set; }

		[JsonProperty("amount")]
		public int Amount { get; set; }

		[JsonProperty("reforged")]
		public bool Reforged { get; set; }
	}
	#endregion

	#region ItemSpell
	/// <summary>
	/// {
	///		"spellId": 5004,
	///		"spell": {},
	///		"nCharges": 1,
	///		"consumable": true,
	///		"categoryId": 11,
	///		"trigger": "ON_USE"
	///	}
	/// </summary>
	[JsonObject]
	public class ItemSpell
	{
		[JsonProperty("spellId")]
		public int SpellId { get; set; }

		[JsonProperty("spell")]
		public Spell Spell { get; set; }

		[JsonProperty("nCharges")]
		public int NCharges { get; set; }

		[JsonProperty("consumable")]
		public bool Consumable { get; set; }

		[JsonProperty("categoryId")]
		public int CategoryId { get; set; }

		[JsonProperty("trigger")]
		public string Trigger { get; set; }
	}
	#endregion

	#region WeaponInfo
	/// <summary>
	///	{
	///		"damage": {},
	///		"weaponSpeed": 2.6,
	///		"dps": 1103.4615
	///	}
	/// </summary>
	[JsonObject]
	public class WeaponInfo
	{
		[JsonProperty("damage")]
		public FloatMinMax Damage { get; set; }

		[JsonProperty("weaponSpeed")]
		public float WeaponSpeed { get; set; }

		[JsonProperty("dps")]
		public float Dps { get; set; }
	}
	#endregion

	#region SetBonus
	/// <summary>
	/// {
	///		"description": "在使用激活之后，你所有治疗法术消耗的法力值降低25%，持续15秒。",
	///		"threshold": 2
	///	},
	/// </summary>
	[JsonObject]
	public class SetBonus
	{
		[JsonProperty("description")]
		public string Description { get; set; }

		[JsonProperty("threshold")]
		public int Threshold { get; set; }
	}
	#endregion

	#region SocketInfo
	/// <summary>
	/// {
	///		"sockets": [],
	///		"socketBonus": "+30 智力"
	///	}
	/// </summary>
	[JsonObject]
	public class SocketInfo
	{
		[JsonProperty("sockets")]
		public Socket[] Sockets { get; set; }

		[JsonProperty("socketBonus")]
		public string SocketBonus { get; set; }
	} 
	#endregion

	#region Socket
	/// <summary>
	/// {
	///		"type": "META"
	///	}
	/// </summary>
	[JsonObject]
	public class Socket
	{
		[JsonProperty("type")]
		public string Type { get; set; }
	} 
	#endregion

	#region ItemSource
	/// <summary>
	/// {
	///		"sourceId": 2332,
	///		"sourceType": "CREATED_BY_SPELL"
	///	}
	/// </summary>
	[JsonObject]
	public class ItemSource
	{
		[JsonProperty("sourceId")]
		public int SourceId { get; set; }

		[JsonProperty("sourceType")]
		public string SourceType { get; set; }
	} 
	#endregion

	#region FloatMinMax
	/// <summary>
	/// {
	///		"min": 941.4999839663506,
	///		"max": 941.4999839663506
	///	},
	/// </summary>
	[JsonObject]
	public class FloatMinMax
	{
		[JsonProperty("min")]
		public double Min { get; set; }

		[JsonProperty("max")]
		public double Max { get; set; }
	}
	#endregion
}
